<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者，助力中小企业发展 
+----------------------------------------------------------------------
| Copyright (c) 2017～2024  www.wdadmin.cn    All rights reserved.
+----------------------------------------------------------------------
| 沃德代驾系统并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn>   www.wdadmin.cn
+----------------------------------------------------------------------
| 行程录音 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->

<template>
	<view class="container" :style="{'--theme-color': themeColor}" v-if="loadEnd">
		<view class="container-header">
			<view class="header-title">行程录音</view>
			<view class="header-subtitle">行程录音，预防冲突</view>
			<image class="header-icon" src="/static/microphone.png" mode="aspectFit"></image>
		</view>
		<view class="container-main">
			<mp-html :content="introduceContent"></mp-html>
		</view>
		<view class="container-footer">
			<view class="footer-label" @click.stop="toAgreement()">点击查看<text class="text">《行程录音信息处理协议》</text></view>
			<view class="safe-padding"></view>
		</view>
	</view>
</template>

<script>
	import { mapState } from "vuex"
	export default {
		computed: {
			...mapState({
				themeColor: state => state.app.themeColor,
			})
		},
		data() {
			return {
				// 加载完成
				loadEnd: false,
				// 介绍内容
				introduceContent: "",
			}
		},
		onLoad() {
			uni.showLoading({
				title: "加载中"
			})
			this.getIntroduce(() => {
				this.loadEnd = true
				uni.hideLoading()
			})
		},
		methods: {
			// 获取介绍内容
			getIntroduce(fn) {
				this.$util.request("main.recording.content", {
					type: 1,
				}).then(res => {
					if (fn) fn()
					if (res.code == 1) {
						this.introduceContent = res.data.content
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				}).catch(error => {
					console.error('获取介绍内容 ', error)
				})
			},
			// 跳转协议
			toAgreement() {
				this.$util.toPage({
					mode: 1,
					path: "/pages/driver/mine/security/agreement?type=1",
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #FFF;
	}

	.container {
		padding-bottom: 80rpx;

		.container-header {
			position: relative;
			padding: 40rpx 48rpx;
			background: linear-gradient(90deg, var(--theme-color) 0%, #FFF 300%);
			overflow: hidden;

			.header-title {
				color: #FFF;
				font-size: 32rpx;
				font-weight: 600;
				line-height: 44rpx;
			}

			.header-subtitle {
				margin-top: 16rpx;
				color: #FFF;
				font-size: 28rpx;
				line-height: 40rpx;
			}

			.header-icon {
				position: absolute;
				top: 36rpx;
				right: 48rpx;
				width: 160rpx;
				height: 160rpx;
			}
		}

		.container-main {
			padding: 32rpx 48rpx;
			font-size: 28rpx;
			line-height: 40rpx;
		}

		.container-footer {
			position: fixed;
			left: 0;
			right: 0;
			bottom: 0;
			padding: 20rpx 24rpx;
			background: #FFF;
			z-index: 98;

			.footer-label {
				color: #8D929C;
				text-align: center;
				font-size: 28rpx;
				font-weight: 600;
				line-height: 40rpx;

				.text {
					color: #353C57;
				}
			}
		}
	}
</style>